<?php get_header(); ?>
<!-- content start -->
<div id="content">
  <?php get_sidebar(); ?>
  <!-- maincontent start -->
  <div id="maincontent"> 

  <?php if(have_posts()) : ?>
  <?php while(have_posts()) : the_post(); ?>

	<div class="post">
        <div class="title" >
            <h1><?php the_title(); ?></h1>
            <div class="postmetadata">
                <span class="author">Author:<?php the_author(); ?></span> <span class="date"><?php the_time('F jS, Y') ?></span><span class="cat">Cat:<?php the_category(' ,') ?></span>
            </div> <!-- postmetadata end -->
        </div><!-- title end -->

        <div style="margin: 5px 0px 0px 0px;">
        <h3>Contenido relacionado para resetear impresora</h3>
        <?php $huevogallina=rand(1,2); ?>
        <?php if($huevogallina==1){ ?>
	        <div class="directory-adsense">
	             <?php //wpads('Contenido-Antesposts'); ?>
			<?php echo "Texto Ads 1"; ?>
	        </div><!-- directory-adsense end -->
        <?php } ?>

        <div class="directory-same-adsense">
		<?php //wpads('ImagenDerechaEnPost'); ?>
		<?php echo "imagen En Post"; ?>
        </div><!-- directory-adsense end -->

        <?php if($huevogallina==2){ ?>
	        <div class="directory-adsense">
	             <?php //wpads('Contenido-Antesposts'); ?>
			 <?php echo "Texto Ads 2"; ?>
	        </div><!-- directory-adsense end -->
        <?php } ?>

      </div>
	<div class="clearfix"></div>

      <?php the_content(); ?>
      <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
      <?php the_tags( '<p><strong>Tags:</strong> ', ', ', '</p>'); ?>

	<div class="clearfix"></div>
        <div class="directory-same-adsense">
          <?php
            $posts = get_posts('numberposts=4&orderby=rand');
            foreach($posts as $post) : ?>
            <div class="directory-ad" >
		<div class="directory-title" >
		<h2><a href="<?php the_permalink() ?>" title="Enlace directo a <?php the_title(); ?>"><?php the_title(); ?></a></h2>
		<div class="directory-excerpt">
			<?php $content = limit_words($post->post_excerpt,14); ?>
			<?php if(strlen(trim($content))>0){?>
			<?php echo $content; ?>
			<?php }else{?>
			<?php echo " Enlace de acceso directo para el articulo ".the_title(); ?>
			<?php }?>
		</div>
		</div>

            </div> <!-- directory-ad end -->
            <?php endforeach;?>
        </div> <!-- directory-same-adsense end -->
	<div class="clearfix"></div>

    <div class="comment_frame">
      <?php 
							if (function_exists('wp_list_comments')) {
								comments_template('/comments.php', true);
							}
							else {
								comments_template('/comments-old.php');
							}
						?>
    </div><!-- comment_frame end -->

	</div><!-- post end -->
  <?php endwhile; ?>
  <div class="clearfix"></div>
  <?php else : ?>

  <div class="notfound">
    <p>Post Not Found!</p>
    <p>Please try again.</p>
  </div><!-- notfound end -->
  <?php endif; ?>

  </div><!-- maincontent end -->

</div><!-- content end -->
<div style="clear:both"></div>

<?php get_footer(); ?>